package com.study.designpattern.singleton;

/**
 * ------------双重锁-------------
 * --------双重校验锁，线程安全----
 */
public class SingletonDoubleLock {
    private static volatile SingletonDoubleLock singletonDoubleLock;
    private SingletonDoubleLock(){}

    private static SingletonDoubleLock getSingletonDoubleLock(){
        if (singletonDoubleLock==null){
            synchronized (SingletonDoubleLock.class){
                if (singletonDoubleLock==null){
                    singletonDoubleLock=new SingletonDoubleLock();
                }
            }
        }
        return singletonDoubleLock;
    }
}
